#!/bin/bash
##mariadb数据库初始化脚本
##更新时间：2018年11月27日
##By:雅宸
echo -e ' ——————-----------------------------------------初始化数据库=============================================—————'
expect -c "
spawn /usr/bin/mysql_secure_installation
expect \"Enter current password for root (enter for none):\"
send \"\r\"
expect \"Set root password?\"
send \"y\r\"
expect \"New password:\"
send \"$pass\r\"
expect \"Re-enter new password:\"
send \"$pass\r\"
expect \"Remove anonymous users?\"
send \"y\r\"
expect \"Disallow root login remotely?\"
send \"n\r\"
expect \"Remove test database and access to it?\"
send \"y\r\"
expect \"Reload privilege tables now?\"
send \"y\r\"
expect eof
"
echo -e ' ——————-----------------------------------------初始化数据库完成=========================================—————'
